import { _decorator, Button, Component, Node } from 'cc';
import { eventTarget, GameEvent } from '../Events/EventBus';
const { ccclass, property } = _decorator;

@ccclass('UIManager')
export class UIManager extends Component {
    
    
    private buttonAttackA: Button = null;

    start() {
        // 获取普攻按钮组件
        this.buttonAttackA = this.node.getChildByName('AttackA').getComponent(Button);

        // 监听普攻按钮点击事件，并触发事件回调
        this.buttonAttackA?.node.on(Button.EventType.CLICK, this.onClickAttackA, this);
    }

    onClickAttackA(){
        // 派发普通攻击事件
        eventTarget.emit(GameEvent.PLAYER_NORMAL_ATTACK);
        // console.log("普通攻击按钮被点击了！");
    }

    update(deltaTime: number) {
        
    }
}


